package com.kuang.controller.category;


import com.kuang.auth.CheckAdminLogin;
import com.kuang.auth.CheckLogin;
import com.kuang.common.anno.IgnoreToken;
import com.kuang.common.base.BaseController;
import com.kuang.entity.Category;
import com.kuang.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author yykk
 * @description:轮播图模块
 * @date 2021/08/10 22:32
 */
@RestController
public class CategoryController extends BaseController {

    @Autowired
    private CategoryService categoryService;

    /**
     * 查询轮播图的信息
     * http://localhost:8089/api/v1/banner/list
     *
     * @return
     */
    @GetMapping("/category/root")
    @CheckAdminLogin("admin")
    public List<Category> findCategoryRoot() {
        return categoryService.findCategoryRoot();
    }


    /**
     * 查询轮播图的信息
     * http://localhost:8089/api/v1/banner/list
     *
     * @return
     */
    @GetMapping("/category/list")
    @CheckAdminLogin("admin")
    public List<Category> findCategoryTree() {
        return categoryService.findCategoryTrees();
    }


    /**
     * 查询轮播图的信息
     * http://localhost:8089/api/v1/banner/list
     *
     * @return
     */
    @GetMapping("/category/list2")
    @CheckAdminLogin("admin")
    public List<Map<String,Object>> findCategoryTree2() {
        return categoryService.findCategoryTreesMap();
    }
}
